package cn.edu.scau.cmi.mingjunhui.adapter;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;


public class AdapterOfClass extends SortUtil implements SortStudentUtil{

	@Override
	public List<Student> sort(List<Student> studentList) {
		List<Integer> s_idList = studentList.stream()
				.map(student -> student.getId())
				.collect(Collectors.toList());
		s_idList = sortInt(s_idList);
		List<Student> list = new ArrayList<>(studentList.size());
		for (Integer s_id : s_idList) {
			for (Student student : studentList) {
				if (student.getId() == s_id) {
					list.add(student);
					break;
				}
			}
		}
		return list;
	}

	
}
